// columns.ts

import DictTag, { DictValueEnum } from "@/components/DictTag";
import { createIcon } from "@/utils/IconUtil";
import { ProColumns } from "@ant-design/pro-table";
import { Avatar, Divider, Dropdown, MenuProps, Popconfirm, Space, Switch, Typography } from "antd";

// 定义所有列的工厂函数
export const createTableColumns = (
	statusOptions: DictValueEnum,
	handleColumnDetails: (record: API.Setting.LoginLogVo) => void
): ProColumns<API.Setting.LoginLogVo>[] => {
	return [
		{
			title: "用户账号",
			dataIndex: "userName",
			valueType: "text"
		},
		{
			title: "IP地址",
			dataIndex: "ipaddr",
			valueType: "text"
		},
		{
			title: "登录地点",
			dataIndex: "loginLocation",
			valueType: "text",
			hideInSearch: true
		},
		{
			title: "登录设备",
			dataIndex: "browser",
			valueType: "text",
			hideInSearch: true
		},
		{
			title: "操作系统",
			dataIndex: "os",
			valueType: "text",
			hideInSearch: true,
			ellipsis: true
		},
		{
			title: "消息提示",
			dataIndex: "msg",
			valueType: "text",
			hideInSearch: true,
			ellipsis: true
		},
		{
			title: "登录时间",
			dataIndex: "loginTime",
			valueType: "dateTime"
		},
		{
			title: "操作",
			dataIndex: "option",
			valueType: "option",
			render: (_, record: any) => {
				return (
					<Typography.Link
						key="details"
						onClick={() => {
							handleColumnDetails(record);
						}}
					>
						详情
					</Typography.Link>
				);
			}
		}
	];
};
export const tableTab: any = [
	{
		key: "oper",
		label: <span>登录成功</span>
	},
	{
		key: "error",
		label: <span>登录异常</span>
	}
];

export const pagination = {
	showQuickJumper: true,
	showSizeChanger: true
};
